<%--
  Created by IntelliJ IDEA.
  User: TaoSheng
  Date: 2022/10/12
  Time: 16:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>确认订单界面</title>
    <link rel="stylesheet" href="../css/jiesuan.css">
    <script src="../js/jquery-3.6.0.min.js"></script>
</head>
<body>
<!-- 头部 -->
<div class="head">
    <div class="logo">
        <img src="../images/detail_logo.png" class="logo">
    </div>
    <span class="jiesuan">结算页面</span>
</div>
<!-- 填写并请核对结算订单 -->
<div class="check-tit">
    <span class="tianxie">填写并核对结算订单</span>
</div>
<div class="all">
    <!-- 收货人信息 -->
    <div class="step">
        <h3>收货人信息</h3>
        <a href="" class="zengshouhuo" >新增收货人地址</a>
    </div>

    <!-- 收货地址 -->
    <form action="${pageContext.request.contextPath}/createMyorder" method="post">
    <div class="step2">
        <input type="text" value=${user.userNickname} class="text-1">

        <div style="border: none;" class="text-2">
<%--        <input type="text" style="border: none;" class="text-2" value="郑宏途 江苏 苏州市 苏州工业园区 斜塘街道 ******** ">--%>
            <select name="addressChosed">
                <option>未选择收件地址</option>
                <c:forEach var="address" items="${addressList}">
                <option>${address.addressProvince}${address.addressCity}${address.addressArea}${address.addressDetail}</option>
                </c:forEach>
            </select>
        </div>
<%--        <input type="hidden" value="${product}" name="product">--%>
<%--        <input type="hidden" value="${user}" name="user">--%>
        <span class="tel">183****9455</span>

        <a href="" class="bianji"> 编辑</a>
    </div>
    <!-- 支付方式 -->
    <div class="step ">
        <h3>支付方式</h3>
    </div>
    <div class=" zhifubao">
        <div class="zhifutupiao"></div>
        <a href="" class="zhifu-text">支付宝支付</a>
    </div>
    <!-- 送货清单 -->
    <div class="step ">
        <h3>送货清单</h3>
        <a href="" class="step-3">返回购物车修改商品</a>
    </div>
    <!-- 商品 -->
    <div class="shangping">
        <span class="item">发货订单</span>
        <span class="item1">数量</span>
        <span class="item1">单价</span>
        <span class="item1">尺码</span>
        <div class="fahuo">
            <img src="../${product.productMainImg}" class="queding" >
            <span class="title">${product.productName}</span>
            <!-- 尺码 -->
            <span class="chima">${product.xx}</span>
            <!-- 单价 -->
            <span class="danjia">￥</span>
            <span class="danjia1">${product.productPrice}</span>
            <span class="shuoliang">1</span>
        </div>
        <!--  -->
    </div>
    <!-- 优惠券 -->
    <div class="youhui">
        <a href="" class="shiyong">使用优惠券</a>
        <label class="diyong">金额抵用:</label>
        <select class="choose">
            <option>不使用优惠券</option>
            <c:forEach var="myCoupon" items="${myCouponsList}">
                <option>${myCoupon.yy}
                    <input name="couponId" type="hidden" value="${myCoupon.couponId}">
                    <input name="couponChosed" type="hidden" value="${myCoupon.mycouponPrice}">
                </option>
            </c:forEach>
        </select>
    </div>
    <!-- 总金额 -->
    <div class="Y">
        <div class="zong">
            <div class="zong-price">
                <span>总商品金额:</span>
                <span>￥</span>
                <span>${product.spikeProductPrice}</span>
            </div>
        </div>
        <!-- 运费 -->
        <div class="zong">
            <div class="zong-price">
                <span>运费:</span>
                <span>￥</span>
                <span>0.00</span>
            </div>
        </div>
    </div>
    <!-- 应付金额 -->
    <div class="last-price">
        <div class="last-price-t">
            <span>应付总额 :</span>
            <span class="A">${product.spikeProductPrice}</span>
            <span class="A1">￥</span>
        </div>
    </div>
    <!-- 提交订单 -->
    <div class="tijiao">
        <input type="submit" value="" class="ti">
    </div>
    </form>
</div>
<script src="../js/jiesuan.js"></script>
<script type="text/javascript">
    $(function() {
        var ws;
        if ("WebSocket" in window) {
            ws = new WebSocket("ws://localhost:8081/demo/webSocket/" + 2);
        }
        //接收到服务端消息时触发
        ws.onmessage = function (evt) {
            let received_msg = evt.data;
            var result = confirm(received_msg);
            if(result){
                //console.log("选择确定")
                window.location.href="${pageContext.request.contextPath}/personal/myOrder.jsp";
            }
        };
    })
</script>
</body>
</html>